package com.yunshipei.inter;

import android.text.TextUtils;

import com.yunshipei.model.TaskModel;

import java.io.IOException;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;

/**
 * Created by cike on 16/11/8.
 */

public abstract class EnterCallBack implements Callback {
    private TaskModel model;

    public EnterCallBack(TaskModel taskModel) {
        this.model = taskModel;
    }

    @Override
    public void onFailure(Call call, IOException e) {
//        if (model != null && !TextUtils.isEmpty(model.getSaveDir())) {
//
//        }
        onFailureHandle(call, e, model);
    }

    @Override
    public void onResponse(Call call, Response response) throws IOException {
        onResponseHandle(call, response, model);
    }

    public abstract void onFailureHandle(Call call, IOException e, TaskModel task);

    public abstract void onResponseHandle(Call call, Response response, TaskModel task) throws IOException;
}
